package com.Utils;


import java.io.*;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;

public class Log {
    private static final String logpath = "/lustre/sdb/xueyj/htmlScript/log";
    //private static final String logpath = "C:\\Users\\Administrator\\Desktop\\so\\htmlScript\\log";
    private static String sst = new SimpleDateFormat("HH:mm:ss").format(new Date());
    private static String ssm = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
    private static String sp = File.separator;

    public static void printlog(String packagepath, Boolean k, String htmlname, ArrayList<String> list, String moban) throws IOException {
        File file = new File(logpath + sp + "log" + ".txt");
        BufferedWriter writer = new BufferedWriter(new FileWriter(file, true));
        String result = ssm + " " + sst + "   " + packagepath + " " + moban + "    " + htmlname + ".html" + "    " + k + "";
        writer.write(result);
        writer.newLine();
        for (String s : list) {
            writer.write("                " + s);
            writer.newLine();
        }
        writer.newLine();
        writer.close();
    }

    public static void printlog(String packagepath, Boolean k, String htmlname, String moban) throws IOException {
        File file = new File(logpath + sp + "log" + ".txt");
        BufferedWriter writer = new BufferedWriter(new FileWriter(file, true));
        String result = ssm + " " + sst + "   " + packagepath + " " + moban + "    " + htmlname + ".html" + "    " + k + "";
        writer.write(result);
        writer.newLine();
        writer.newLine();
        writer.close();
    }
}
